﻿// JavaScript Document
var oAjax=null;
var oAction=0;
function  createAjax(URL,val){		
	preloadAjax(val);
	if (window.XMLHttpRequest) 
	{
		oAjax = new XMLHttpRequest();
		oAjax.onreadystatechange = process;
		oAjax.open("GET", URL, true);
		oAjax.send(null);			
	} else if (window.ActiveXObject) 
	{
		oAjax = new ActiveXObject("Microsoft.XMLHTTP");
		if (oAjax) 
		{
			oAjax.onreadystatechange = process;
			oAjax.open("GET", URL, true);
			oAjax.send();			
		}
	}
}
function preloadAjax(val)
{	
	oAction=val;
	str='<img src="Images/GIF/Preload.gif" align="center" valign="middle" border="0"/>&nbsp;Loading...';
	switch (oAction)
	{
		case 1:group_check_bool=1; break;	
		case 2:user_check_bool=1; break;	
		case 3:document.getElementById('imgCaptcha').innerHTML=str; break;
		default:document.getElementById('selNews_div').innerHTML=str; break;					
	}
}
function process()
{
	if (oAjax.readyState == 4) 
	{		
		if (oAjax.status == 200) 
		{	
			switch (oAction)
			{
				case 1:group_check_exist=oAjax.responseText;group_check_bool=0; break;
			    case 2:user_check_exist=oAjax.responseText;user_check_bool=0; break;	
				case 3:document.getElementById('imgCaptcha').innerHTML=oAjax.responseText; break;
				default:document.getElementById('selNews_div').innerHTML=oAjax.responseText; break;				
			}
		}
	}
}